{include file="common/header.tpl"}
<body>
{assign var="partner" value="current"}
{include file="common/toptab.tpl"}
<div id="tabs4">
</div>
<script src="includes/js/download.js" type="text/javascript"></script>
{if $smarty.get.sub1 == 'editdownload'}
	{include file='download_edit.tpl'}
{elseif $smarty.get.sub1 == 'adddownload'}
	{include file='download_add.tpl'}    
{else}
<div class="wrap">
<table width="100%" height="100%" cellpadding="0" cellspacing="0">
	<tr>
	<td width="54px" height="43px" class="fr_lefttop"></td>
	<td height="43px" class="fr_centertop" ></td>
	<td width="48px" height="43px" class="fr_righttop"></td>
	</tr>
	<tr>
	<td width="54px" class="fr_leftmiddle" >&nbsp;</td>
<td class="fr_centermiddle">
{if $smarty.cookies.message == null}
	<div id="ajaxResponse1" class="ajaxResponse"></div>
{else}
	<div id="ajaxResponse1" class="ajaxResponse fade" style="display:block">{if $smarty.cookies.message != NULL}{$smarty.cookies.message}{/if}</div>
{/if}
<h2>{t}Download{/t}</h2>
	<p>
		<a href="?mod={$smarty.get.mod}&sub1=adddownload">
				<b>{t escape=no}Create New Download &raquo;{/t}</b></a>
	</p>
	<table class="widefat">
		<thead>
		<tr>
			<th scope="col" style="text-align: center">{t}ID{/t}</th>
	        <th scope="col">{t}Name{/t}</th>
	        <th scope="col">{t}Product{/t}</th>
	        <th scope="col" style="text-align: center">{t}File{/t}</th>
	        <th colspan="2" style="text-align: center">{t}Action{/t}</th>
		</tr>
		</thead>
		<tbody id="advtable">
			{foreach name=adv from=$ALLDOWNLOAD.data item=item}
				<tr id="download-{$item->download_id}" class="{cycle values=,alternate}">
					<th scope='row' style='text-align: center'>{$item->download_id}</th>
					<td>{$item->download_name}</td>
					<td>
						{if $item->product_name != null}
							{$item->product_name}
						{else}
							None
						{/if}
					</td>
					<td align='center'>{$item->file}</td>
					<td>
                   	  <a href="?mod=downloadman&sub1=editdownload&id={$item->download_id}" class='edit'>{t}Edit{/t}</a>
                     </td>
					<td>
                    	<a onClick="onDeleteDownload('?mod=downloadman', '{$item->download_id}','{$item->file}')" 
								class='delete'>{t}Delete{/t}</a></td>
				</tr>
			{/foreach}
    	</tbody>
	</table>
    {if $ALLDOWNLOAD.TOTALPAGE > '0' }
    <div>			
             		
              <div style="text-align:right; float:right" >{$ALLDOWNLOAD.FIRST} {$ALLDOWNLOAD.PRE}&nbsp;{$ALLDOWNLOAD.LISTPAGE}  {if $smarty.session.LC_ALL eq "en"}Pages{else}Trang{/if} &nbsp; {$ALLDOWNLOAD.TOTALPAGE} &nbsp;                   
                  &nbsp;{$ALLDOWNLOAD.NEXT} {$ALLDOWNLOAD.LAST}         
              </div>
              <div style="clear:both"></div>		
    </div>	     
    {/if}

</td>
<td width="48px" class="fr_rightmiddle"></td>
</tr>
<tr>
<td width="54px" height="60px" class="fr_leftbot" ></td>
<td height="60px" class="fr_centerbot"></td>
<td width="48px" height="60px" class="fr_rightbot" ></td>
</tr>
</table>
</div>
{/if}
</body>